<template>
    <div class="participant wrap-table">
        <!--按需加载-->
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="基本信息" name="first" :lazy="true">
                <user-info :change-index="changeIndex" ref="childMethod"></user-info>
            </el-tab-pane>
            <el-tab-pane label="健康现况" name="second" :lazy="true">
                <user-health :change-index="changeIndex" @watchWeight="watchWeight"></user-health>
            </el-tab-pane>
            <el-tab-pane label="日程待办" name="third" :lazy="true">
                <user-date :change-index="changeIndex"></user-date>
            </el-tab-pane> 
            <el-tab-pane label="生活方式问卷" name="fourth" :lazy="true">
                <user-p1 :change-index="changeIndex"></user-p1>
            </el-tab-pane>
            <el-tab-pane label="行动计划"  name="fifth" :lazy="true">
                <user-move :change-index="changeIndex"></user-move>
            </el-tab-pane>
            <el-tab-pane label="营养处方" name="eighth" :lazy="true">
                <nur-pre :change-index="changeIndex"></nur-pre>
            </el-tab-pane>
            <el-tab-pane label="家长体重记录" name="sixth" :lazy="true">
                <user-weight :change-index="changeIndex"></user-weight>
            </el-tab-pane>
            <el-tab-pane label="儿童生长发育记录" name="sixsixsixTh" :lazy="true">
                <user-growh :change-index="changeIndex"></user-growh>
            </el-tab-pane>
            <el-tab-pane label="母乳喂养处方" name="tenth" :lazy="true">
                <out-pation :change-index="changeIndex"></out-pation>
            </el-tab-pane>
            <el-tab-pane label="阅读记录" name="seventh" :lazy="true">
                <user-record :change-index="changeIndex"></user-record>
            </el-tab-pane>
            <el-tab-pane label="心理健康筛查" name="ninth" :lazy="true">
                <person-heart :change-index="changeIndex"></person-heart>
            </el-tab-pane>
             <el-tab-pane label="母乳喂养自我效能表" name="breastfeeding" :lazy="true">
                <breastfeeding :change-index="changeIndex"></breastfeeding  >
            </el-tab-pane>
            <!--<el-tab-pane label="膳食记录" name="seventh"></el-tab-pane>-->
        </el-tabs>
        <!---->
    </div>

</template>
<script>
import userInfo from './userInfo.vue'  //个人信息
import userHealth from './userHealth.vue'  //健康状况
import userP1 from './userP1.vue'  //P1问卷
import userMove from './userMove.vue'  //行动计划
import userWeight from './userWeight.vue'  //体重记录
import userDate from './userDate.vue'  //日程代办
import userRecord from './userRecord.vue'  //阅读记录
import nurPre from './nurPre.vue'  //阅读记录
import personHeart from './personHeart.vue'  //心理健康筛查
import outPation from './outPation.vue'  //哺乳门诊
import breastfeeding from './breastfeeding.vue'  //心理健康筛查
import userGrowh from './userGrowh.vue'     //儿童生长发育
export default {
    data() {
        return {
            searchData:{
                mobile:'',
                researchNo:'',
            },
            activeName: 'first',
            changeIndex:'0',
            changeObj:{},
        }
    },
    components:{
        userInfo,
        userHealth,
        userP1,
        userMove,
        userWeight,
        userDate,
        userRecord,
        nurPre,
        personHeart,
	    outPation,
        personHeart,
        breastfeeding,
	    userGrowh
    },
    created() {

    },
    methods: {
        handleClick(tab, event) {   //切换tab
            let index=tab.index;
            this.changeIndex=index;
            this.changeObj=this.searchData
        },
        watchWeight(val){
            this.changeIndex='5';
            this.activeName='sixth';
        },
        goBack(){   //原生返回
            this.$router.push({
                path:'/participant/list'
            })
            let view = this.$route;
            this.$store.dispatch('delVisitedViews', view); //关闭tab，跳转到上一级
        },
        searchHandler(){   //查询
            let that=this;
            if(that.searchData.mobile=='' &&that.searchData.researchNo==''){
                that.$notify.info({
                    title: '提示',
                    message: '请输入查找的内容'
                });
                return
            }
            that.activeName='first';
            that.$store.commit('SET_RESECHOBJ',that.searchData)
            that.$refs.childMethod.getList()
        },

    },
    mounted:function(){
        let that=this;
        let query=that.$route.query;
        if(query.isOther){
            if(query.isOther==1){
                that.activeName='fourth';
            }
            else if(query.isOther==2){
                that.activeName='fifth';
            }
            else if(query.isOther==3){
                that.activeName='eighth';
            }
        }
    }
  }
</script>
<style>

</style>
